(function(){
	angular.module('app')
	.directive('myColpicker', pickerCtrl);
	function pickerCtrl(){
		return {
			restrict : 'AE',
			scope : {
				myColpicker : '=',
				getColor : '&'
			},
			link : function( scope, element, attrs ){
				var inner = element.find('.evo-pop'); 
				
				element.colorpicker({color:'#000'});//设初始值
				
				element.on('click',function( event ){
					var inner = element.find('.evo-pop'); 
					if( inner.css('display') == 'block' ){
						inner.css('display','none');
						var value = element.colorpicker("val");
						scope.$apply(function(){
							scope.getColor({color: value});
						})
					}else{
						inner.css('display','block');
					}
				});
			}
		}
	}
})();
